/*河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
*/
package cn.javaxc.mes.action.produce;
import java.io.*;
import java.util.*;
import java.sql.*;
import cn.javaxc.model.base.SQL;
import cn.javaxc.model.base.SQLList;
import cn.javaxc.model.base.SQLMap;
import cn.javaxc.model.base.SQLParam;
import cn.javaxc.model.page.BatisPage;
import cn.javaxc.mvcwork.controller.web.TreeBean;
import cn.javaxc.mvcwork.util.common.CommonUtil;
import cn.javaxc.mvcwork.util.common.MapListUtil;
import cn.javaxc.mvcwork.util.helper.FrameHelper;
import cn.javaxc.mvcwork.util.helper.TreeTableHelper;
import org.springframework.beans.factory.annotation.Autowired;
import cn.javaxc.system.action.base.BaseAction;
import cn.javaxc.mes.mapper.produce.ProductionPlanMangeMapper;
public class ProductionPlanMange extends BaseAction
{
    @Autowired(required=false)
	private ProductionPlanMangeMapper mapper;
    /**
    统计图
    */
    
    public Map productionPlanStatistical() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        super.listDepartments();
        
        
        SQLList<SQLMap> all=mapper.all(params);
        result.put("all", all);
        
        
        result.put("s_search", pagination.getSearchParas());
        
        return result;
    }
    /**
    */
    
    public Object s_plan() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_plan=mapper.s_plan(params,pagination);
        s_plan.setPagedListInfo(pagination);
        result.put("s_plan", s_plan);
        
        return s_plan;
    }
    /**
    饼状统计图
    */
    
    public Map productionPlanPancake() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        SQLList<SQLMap> s_c=mapper.s_c(params);
        result.put("s_c", s_c);
        
        return result;
    }
    /**
    增加生产计划
    */
    
    public Map increaseProductionPlan() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        result.put("s_ecode", create_emtcode(100));
        
        return result;
    }
    /**
    转入生产
    */
    
    public Map transferProduction() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        SQLList<SQLMap> t_plan=mapper.t_plan(params);
        SQLMap t_plan_emt=t_plan.getExistfirst();
        result.put("t_plan", t_plan_emt);
        
        
        SQLList<SQLMap> s_list=mapper.s_list(params);
        result.put("s_list", s_list);
        
        return result;
    }
    /**
    流程明细
    */
    
    public Map processDetail() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        Object CMIDcategory_id =mapper.CMIDcategory_id(params);
        result.put("CMIDcategory_id", CMIDcategory_id);
        
        
        SQLList<SQLMap> s_step=mapper.s_step(params);
        result.put("s_step", s_step);
        
        
        SQLList<SQLMap> t_info=mapper.t_info(params);
        SQLMap t_info_emt=t_info.getExistfirst();
        result.put("t_info", t_info_emt);
        
        return result;
    }
    /**
    流程图
    */
    
    public Map flowChart() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        Object CMIDcategory_id =mapper.CMIDcategory_id(params);
        result.put("CMIDcategory_id", CMIDcategory_id);
        
        
        Object plan_name =mapper.plan_name(params);
        result.put("plan_name", plan_name);
        
        
        SQLList<SQLMap> steps=mapper.steps(params);
        result.put("steps", steps);
        
        
        SQLList<SQLMap> skips=mapper.skips(params);
        result.put("skips", skips);
        
        return result;
    }
    /**
    */
    
    public Map d_plan() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_plan(params);
        
        return result;
    }
    /**
    增加生产计划修改
    */
    
    public Map increaseProductionPlanSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int plan_work_id = mapper.plan_work_id(params);
        result.put("plan_work_id", plan_work_id);
        
        
        int CMIDplan_id = mapper.CMIDplan_id(params);
        result.put("CMIDplan_id", CMIDplan_id);
        
        
        int purchase_list = mapper.purchase_list(params);
        result.put("purchase_list", purchase_list);
        
        
        int u_step_skipwork = mapper.u_step_skipwork(params);
        result.put("u_step_skipwork", u_step_skipwork);
        
        return result;
    }
    /**
    转入生产修改
    */
    
    public Map transferProductionSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        Object CMIDcategory_id =
        mapper.CMIDcategory_id(params);
        result.put("CMIDcategory_id", CMIDcategory_id);
        
        
        for (SQLMap emt:hqlBean.getTableElements("")){
            params=new SQLParam(request,emt.getMap());
            mapper.b_stock_goods(params);
        }
        
        
        int CMIDproduce_plan_id = mapper.CMIDproduce_plan_id(params);
        result.put("CMIDproduce_plan_id", CMIDproduce_plan_id);
        
        
        int plan_work_id = mapper.plan_work_id(params);
        result.put("plan_work_id", plan_work_id);
        
        
        mapper.transferProductionSubmit(params);
        
        
        
        return result;
    }
    /**
    流程图修改
    */
    
    public Map flowChartSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        TreeTableHelper.parseFlowJson(context,request.getParameter("pathInfo"));
        
        
        for (SQLMap emt:hqlBean.getTableElements("")){
            params=new SQLParam(request,emt.getMap());
            mapper.flowChartSubmit(params);
        }
        
        return result;
    }
    /**
    */
    
    public Map d_plan_step() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_plan_step(params);
        
        return result;
    }
}